#include "include/Player.h"
#include "include/Utils.h"
#include "include/GlobalGameObj.h"

#include <stdlib.h>
#include <vector>

int Player::GetPlayerInfo(int thread_id, int player_id, PlayerInfo *p_info)
{
	string value;
	
	gameObjectPool[thread_id]->model_proxy.GetObjectById(
		"tbl_player", "id", player_id, value);

	vector<string> strList;

	// test
	cout << "before string2array" << value << endl;

	Utils::Str2StrList(value, strList, '|');

	int i = 0;
	p_info->id = atoi(strList[i++].c_str());
	p_info->account = strList[i++];
	p_info->character_ids = strList[i++];


	cout << "after string2array" << endl;
	cout << "id: " << p_info->id << endl;
	cout << "account: " << p_info->account << endl;
	cout << "character_ids: " << p_info->character_ids << endl;

	return 0;
}

